home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / KoDocumentInfo.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-30  |  5.6 KB  |  197 lines

  1. /* This file is part of the KDE project
  2.    Copyright (C) 1998, 1999, 2000 Torben Weis <weis@kde.org>
  3.    Copyright (C) 2004 David Faure <faure@kde.org>
  4.  
  5.    This library is free software; you can redistribute it and/or
  6.    modify it under the terms of the GNU Library General Public
  7.    License as published by the Free Software Foundation; either
  8.    version 2 of the License, or (at your option) any later version.
  9.  
  10.    This library is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.    Library General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU Library General Public License
  16.    along with this library; see the file COPYING.LIB.  If not, write to
  17.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.  * Boston, MA 02110-1301, USA.
  19. */
  20.  
  21. #ifndef KO_DOCUMENT_INFO_H
  22. #define KO_DOCUMENT_INFO_H
  23.  
  24. #include <qobject.h>
  25. #include <qmap.h>
  26. #include <kconfig.h>
  27. #include <koffice_export.h>
  28.  
  29. class QString;
  30. class QStringList;
  31. class QDomDocument;
  32. class QDomElement;
  33. class QDomNode;
  34. class QDateTime;
  35. class KoStore;
  36. class KoDocumentInfoPage;
  37. class KoXmlWriter;
  38.  
  39. class KOFFICECORE_EXPORT KoDocumentInfo : public QObject
  40. {
  41.     Q_OBJECT
  42. public:
  43.     KoDocumentInfo( QObject* parent = 0, const char* name = 0 );
  44.     virtual ~KoDocumentInfo();
  45.  
  46.     bool load( const QDomDocument& doc );
  47.     bool loadOasis( const QDomDocument& metaDoc );
  48.  
  49.     QDomDocument save();
  50.     bool saveOasis( KoStore* store );
  51.  
  52.     /**
  53.      * This info has an accessor because it's the most commonly used.
  54.      * Equivalent to page("about")->title() (but checking that the page exists)
  55.      */
  56.     QString title() const;
  57.     QString creator() const;
  58.  
  59.     KoDocumentInfoPage* page( const QString& name ) const;
  60.     QStringList pages() const;
  61.     void documentInfochanged() { emit sigDocumentInfoModifed();}
  62.  signals:
  63.     void sigDocumentInfoModifed();
  64. };
  65.  
  66. class KOFFICECORE_EXPORT KoDocumentInfoPage : public QObject
  67. {
  68. public:
  69.     KoDocumentInfoPage( QObject *parent, const char* name );
  70.  
  71.     virtual bool load( const QDomElement& e ) = 0;
  72.     virtual QDomElement save( QDomDocument& doc ) = 0;
  73.     virtual bool loadOasis( const QDomNode& metaDoc ) = 0;
  74.     virtual bool saveOasis( KoXmlWriter &xmlWriter ) = 0;
  75. };
  76.  
  77. class KOFFICECORE_EXPORT KoDocumentInfoAuthor : public KoDocumentInfoPage
  78. {
  79.     Q_OBJECT
  80. public:
  81.     KoDocumentInfoAuthor( KoDocumentInfo* info );
  82.     ~KoDocumentInfoAuthor();
  83.  
  84.     virtual bool load( const QDomElement& e );
  85.     virtual QDomElement save( QDomDocument& doc );
  86.     virtual bool loadOasis( const QDomNode& metaDoc );
  87.     virtual bool saveOasis( KoXmlWriter &xmlWriter );
  88.  
  89.     QString fullName() const;
  90.     QString initial() const;
  91.     QString title() const;
  92.     QString company() const;
  93.     QString email() const;
  94.     QString telephoneHome() const;
  95.     QString telephoneWork() const;
  96.     QString fax() const;
  97.     QString country() const;
  98.     QString postalCode() const;
  99.     QString city() const;
  100.     QString street() const;
  101.     QString position() const;
  102.  
  103.     void setFullName( const QString& n );
  104.     void setTitle( const QString& n );
  105.     void setCompany( const QString& n );
  106.     void setEmail( const QString& n );
  107.     void setTelephoneHome( const QString& n );
  108.     void setTelephoneWork( const QString& n );
  109.     void setFax( const QString& n );
  110.     void setCountry( const QString& n );
  111.     void setPostalCode( const QString& n );
  112.     void setCity( const QString& n );
  113.     void setStreet( const QString& n );
  114.     void setInitial( const QString& n );
  115.     void setPosition( const QString& n );
  116.     void initParameters();
  117.  
  118. private:
  119.     QString m_fullName;
  120.     QString m_title;
  121.     QString m_company;
  122.     QString m_email;
  123.     QString m_telephoneHome;
  124.     QString m_telephoneWork;
  125.     QString m_fax;
  126.     QString m_country;
  127.     QString m_postalCode;
  128.     QString m_city;
  129.     QString m_street;
  130.     QString m_initial;
  131.     QString m_position;
  132.     KConfig *m_emailCfg;
  133. };
  134.  
  135. class KOFFICECORE_EXPORT KoDocumentInfoAbout : public KoDocumentInfoPage
  136. {
  137.     Q_OBJECT
  138. public:
  139.     KoDocumentInfoAbout( KoDocumentInfo* info );
  140.  
  141.     virtual bool load( const QDomElement& e );
  142.     virtual QDomElement save( QDomDocument& doc );
  143.     virtual bool loadOasis( const QDomNode& metaDoc );
  144.     virtual bool saveOasis( KoXmlWriter &xmlWriter );
  145.  
  146.     QString title() const;
  147.     QString abstract() const;
  148.     QString subject() const;
  149.     QString keywords() const;
  150.     QString initialCreator() const;
  151.     QString editingCycles() const;
  152.     QString creationDate() const;
  153.     QString modificationDate() const;
  154.  
  155.     void setKeywords( const QString &n );
  156.     void setSubject( const QString& n );
  157.  
  158.     void setTitle( const QString& n );
  159.     void setAbstract( const QString& n );
  160.     void saveParameters();
  161.  
  162. public slots:
  163.     void resetMetaData();
  164.  
  165. private:
  166.     KoDocumentInfo* m_docInfo;
  167.     QString m_title;
  168.     QString m_abstract;
  169.     QString m_keywords;
  170.     QString m_subject;
  171.     QString m_initialCreator;
  172.     QDateTime m_creationDate;
  173.     QDateTime m_modificationDate;
  174.     int m_editingCycles;
  175.     bool m_firstSave;
  176. };
  177.  
  178. class KOFFICECORE_EXPORT KoDocumentInfoUserMetadata : public KoDocumentInfoPage
  179. {
  180.     Q_OBJECT
  181. public:
  182.     KoDocumentInfoUserMetadata( KoDocumentInfo* info );
  183.  
  184.     virtual bool load( const QDomElement& e );
  185.     virtual QDomElement save( QDomDocument& doc );
  186.     virtual bool loadOasis( const QDomNode& metaDoc );
  187.     virtual bool saveOasis( KoXmlWriter &xmlWriter );
  188.  
  189.     QMap<QString, QString>* metadataList() { return &m_metaList; }
  190.  
  191. private:
  192.     QMap<QString, QString>  m_metaList;
  193.     QStringList             m_reserved;
  194. };
  195.  
  196. #endif
  197.